<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // generator   迭代生成器
        function *test() {
            yield setTimeout(()=> {console.log(666);t1.next()})
            yield console.log(888)
        }

        var t1 = test() // t1就具有的迭代器
        // console.log(t1)
        // for(let key of t1) {
        //     console.log(key)
        // }
        // 对代码流程进行控制
        t1.next()


    </script>
</body>
</html>